;--------------------------------------------------------------------------- ; Sample Parse-O-Matic Script for TextHarvest ;--------------------------------------------------------------------------- ; ; This script is nearly identical to ScriptSample01.txt but it ; uses a counter to ensure that a maximum of 5 lines of data are ; sent to the output file. ; ;--------------------------------------------------------------------------- ; Check settings. Please see the script file ScriptSample01.txt if you do ; not understand how this section works; the techniques are explained there. ;--------------------------------------------------------------------------- Begin FirstRun = '' FirstRun = 'N' InputFileWanted = 'ThingsToDo.txt' X = Len $OptionX $OptionY $OptionZ Begin X <> 0 M1 = 'Please clear the /Keep /Delete and' $0A$0D M2 = '/Control input boxes and try this' $0A$0D M3 = 'this script again.' Stop M1 M2 M3 End Begin $ActualIFN ~ InputFileWanted M1 = 'Please try this script with the' $0A$0D M2 = 'input file ' InputFileWanted Stop M1 M2 End ; ; If all is well, we'll output a nice header ; SepLine = Padded '' 80 'Left' '-' ; Make a line of 80 dashes OutEnd SepLine OutEnd 'Five lines from ' $ActualIFN OutEnd SepLine End ;--------------------------------------------------------------------------- ; Get the data ;--------------------------------------------------------------------------- Category = $OutData[1 9] ; Get category Description = $OutData[10 999] ; Get description TrimChar Category ; Remove left & right spaces Category = ChangeCase Category 'Hardcaps' ; Capitalize The Text ;--------------------------------------------------------------------------- ; Send to output file ;--------------------------------------------------------------------------- Output '"' Category '",' OutEnd '"' Description '"' Cntr = Cntr+ ; Add 1 (one) to counter ;--------------------------------------------------------------------------- ; Here we will use the Stop command without any parameters. If you gave ; it a message (e.g. Stop 'Finished') the message would appear in a ; pop-up window when the Stop command was triggered. (This gives you ; an attention-getting way to report errors in the data.) ;--------------------------------------------------------------------------- if Cntr = 5 Stop ; Stop when we reach 5